package PTA2.ti30;

import java.util.Scanner;

/**
 * @author Lenovo
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String input = scanner.nextLine();
        char ch = input.isEmpty() ? ' ' : input.charAt(0);
        if (Character.isLetter(ch)) {
            char upper = Character.toUpperCase(ch);
            if (upper >= 'A' && upper <= 'C') {
                System.out.println("2");
            } else if (upper >= 'D' && upper <= 'F') {
                System.out.println("3");
            } else if (upper >= 'G' && upper <= 'I') {
                System.out.println("4");
            } else if (upper >= 'J' && upper <= 'L') {
                System.out.println("5");
            } else if (upper >= 'M' && upper <= 'O') {
                System.out.println("6");
            } else if (upper >= 'P' && upper <= 'S') {
                System.out.println("7");
            } else if (upper >= 'T' && upper <= 'V') {
                System.out.println("8");
            } else if (upper >= 'W' && upper <= 'Z') {
                System.out.println("9");
            }
        } else {
            System.out.println(ch + " is an invalid input");
        }
        scanner.close();
    }
}